class Book:
    def __init__(self, title, authors, year, category, sub_category, language, page_count, keywords, summary,
                 borrowed_count=0, waiting_list=None, loss_records=None, publisher=None, number_of_copies=None):
        self.title = title
        self.authors = authors
        self.year = year
        self.category = category
        self.sub_category = sub_category
        self.language = language
        self.page_count = page_count
        self.keywords = keywords
        self.summary = summary
        self.borrowed_count = borrowed_count
        self.waiting_list = waiting_list if waiting_list is not None else []
        self.loss_records = loss_records if loss_records is not None else []
        self.publisher = publisher
        self.number_of_copies = number_of_copies

    def increment_borrowed_count(self):
        self.borrowed_count += 1

    def add_to_waiting_list(self, student_id):
        if student_id not in self.waiting_list:
            self.waiting_list.append(student_id)
            print(f"Debug: Student {student_id} added to waiting list for book '{self.title}'.")#!!

    def report_loss(self, student_id):
    # 将学生 ID 添加到遗失记录
        if student_id not in self.loss_records:
            self.loss_records.append(student_id)
            print(f"Debug: Student {student_id} added to loss records for book '{self.title}'.")


class Student:
    def __init__(self, student_id):
        self.student_id = student_id
        self.borrowed_books = []
        self.credit_score = 3

    def add_book(self, book_title):
        if len(self.borrowed_books) < 7:
            self.borrowed_books.append(book_title)
            return True
        return False

    def remove_book(self, book_title):
        if book_title in self.borrowed_books:
            self.borrowed_books.remove(book_title)
            return True
        return False

    def deduct_credit(self):
        if self.credit_score > 0:
            self.credit_score -= 1
            return True
        return False